package com.itheima.mapper;

/**
 * @Description: OperateLogMapper
 * @Author: HH
 * @Date: 2025/4/21 16:48
 **/

import com.github.pagehelper.Page;
import com.itheima.pojo.OperateLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 操作日志Mapper接口
 */
@Mapper
public interface OperateLogMapper {
    /**
     * 插入操作日志
     * @param operateLog
     */
    @Insert("insert into operate_log (operate_user, operate_time, class_name, method_name, method_params, return_value, cost_time) "  +
            "values (#{operateUser}, #{operateTime}, #{className}, #{methodName}, #{methodParams}, #{returnValue}, #{costTime});")
    void insert(OperateLog operateLog);

    /**
     * 分页查询操作日志
     * @return
     */
    @Select("select o.*, e.name operateEmpName from operate_log o, emp e where o.operate_user = e.id")
    Page<OperateLog> page();
}
